package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Menu;
import com.hzdl.car.mapper.MenuMapper;
import com.hzdl.car.service.MenuService;
import com.hzdl.car.vo.MenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper mm;


    @Override
    public List<Menu> findAll() {
        return mm.findAll();
    }

    @Override
    public PageInfo findByWhere(MenuVo menuVo) {
        PageHelper.startPage(menuVo.getPage(),menuVo.getLimit());
        List<Menu> mList = mm.findByWhere(menuVo);
        PageInfo pageInfo = new PageInfo(mList);
        return pageInfo;
    }

    @Override
    public int addMenu(MenuVo menuVo) {
        return mm.addMenu(menuVo);
    }

    @Override
    public int updateMenu(MenuVo menuVo) {
        return mm.updateMenu(menuVo);
    }

    @Override
    public int findMenuByPid(Integer id) {
        return mm.findMenuByPid(id);
    }

    @Override
    public int deleteById(Integer id) {
        return mm.deleteById(id);
    }
}
